//
//  ForumCell.m
//  B段项目
//
//  Created by NeyMAr on 15/9/28.
//  Copyright (c) 2015年 昶博. All rights reserved.
//

#import "ForumCell.h"

@implementation ForumCell


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.labelTitle = [[UILabel alloc] init];
        self.labelTitle.numberOfLines = 0;
        [self.contentView addSubview:self.labelTitle];
        
        self.labelAuthor = [[UILabel alloc] init];
        [self.contentView addSubview:self.labelAuthor];
        
        self.labelKind = [[UILabel alloc] init];
        [self.contentView addSubview:self.labelKind];
        
        self.labelCount = [[UILabel alloc] init];
        [self.contentView addSubview:self.labelCount];
        
        self.imageAuthor = [[UIImageView alloc] init];
        self.imageAuthor.image = [UIImage imageNamed:@"作.png"];
        [self.contentView addSubview:self.imageAuthor];
        
        self.imageKind = [[UIImageView alloc] init];
        self.imageKind.image = [UIImage imageNamed:@"论.png"];
        [self.contentView addSubview:self.imageKind];
        
        self.imageCount = [[UIImageView alloc] init];
        self.imageCount.image = [UIImage imageNamed:@"点.png"];
        [self.contentView addSubview:self.imageCount];
        
    }
    return self;
}


- (void)layoutSubviews
{
    [super layoutSubviews];
    
    self.labelTitle.frame = CGRectMake(10 * w, 0, 360 * w, 60 * h);
    self.labelTitle.font = [UIFont boldSystemFontOfSize:17];
    
    self.labelAuthor.frame = CGRectMake(35 * w, 65 * h, 105 * w, 20 * h);
    self.labelAuthor.font = [UIFont systemFontOfSize:15];
    self.labelAuthor.textColor = [UIColor darkGrayColor];
    
    self.labelKind.frame = CGRectMake(165 * w, 65 * h, 95 * w, 20 * h);
    self.labelKind.font = [UIFont systemFontOfSize:15];
    self.labelKind.textColor = [UIColor darkGrayColor];
    
    self.labelCount.frame = CGRectMake(295 * w, 65 * h, 80 * w, 20 * h);
    self.labelCount.font = [UIFont systemFontOfSize:15];
    self.labelCount.textColor = [UIColor darkGrayColor];
    
    
    self.imageAuthor.frame = CGRectMake(10 * w, 65 * h, 20 * w, 20 * h);
    self.imageKind.frame = CGRectMake(140 * w, 65 * h, 20 * w, 20 * h);
    self.imageCount.frame = CGRectMake(270 * w, 65 * h, 20 * w, 20 * h);
}


- (void)setModel:(ForumModel *)model
{
    _model = model;
    NSString *strComment = [NSString string];
    strComment = model.viewCount;
    
    self.labelTitle.text = model.postTitle;
    self.labelAuthor.text = model.author;
    self.labelKind.text = model.forumName;
    self.labelCount.text = [NSString stringWithFormat:@"%@", strComment];
}





/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
